import numpy as np
import cv2

img = cv2.imread("lena.png")
cv2.imshow("original image", img)
print("img shape=", img.shape)
print("img size=", img.size)
print("img dtype=", img.dtype)

b,g,r = cv2.split(img)
blue_img = img[:,:,0]
green_img = img[:,:,1]
red_img = img[:,:,2]

cv2.imshow("blue", b)
cv2.imshow("green", g)
cv2.imshow("red", r)

cv2.imshow("bgr", cv2.merge([b,g,r]))
cv2.imshow("rgb", cv2.merge([r,g,b]))

cv2.waitKey()
cv2.destroyAllWindows()